#!/bin/sh
GEM5=/home/tdwood2/project/gem5-stable/build/ALPHA/gem5.opt
SEPY=/home/tdwood2/project/gem5-stable/configs/example/se.py
CPUTYPE=timing
NUML2CACHE=1

BENCHMARK1=MatrixMultiply
BENCHMARK2=./Benchmarks/basicmath/basicmath_small
BENCHMARK3=./Benchmarks/FFT/fft
BENCHMARK4=./Benchmarks/dijkstra/dijkstra_small
BENCHMARK5=./Benchmarks/qsort/qsort_small

BENCHINPUT4=./Benchmarks/dijkstra/input.dat
BENCHINPUT3="4 4096"
BENCHINPUT5=./Benchmarks/qsort/input_small.dat

STATSOUT=/home/tdwood2/project/project3/Program/mm/stats_1.txt
STDOUT=/home/tdwood2/project/project3/Program/mm/stdout_1.txt
STDERR=/home/tdwood2/project/project3/Program/mm/stderr_1.txt

echo "Loading Modules..."

module load gcc/4.4.7
module load python/2.7.3
module load swig/2.0.10
module load protobuf/2.5.0


echo "****************************************************************"
echo "					Matrix Multiply"
echo "****************************************************************"

echo "Executing gem5..."
echo "Executing Config. No 1"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=8kB --l1i_size=8kB --l1d_assoc=1 --l1i_assoc=1 --l2_assoc=4 --l2_size=16kB --cacheline_size=16 -c $BENCHMARK1


STATSOUT=/home/tdwood2/project/project3/Program/mm/stats_2.txit
STDOUT=/home/tdwood2/project/project3/Program/mm/stdout_2.txt
STDERR=/home/tdwood2/project/project3/Program/mm/stderr_2.txt

echo "Executing Config. No 2"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=8kB --l1i_size=8kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=16kB --cacheline_size=16 -c $BENCHMARK1


STATSOUT=/home/tdwood2/project/project3/Program/mm/stats_3.txt
STDOUT=/home/tdwood2/project/project3/Program/mm/stdout_3.txt
STDERR=/home/tdwood2/project/project3/Program/mm/stderr_3.txt

echo "Executing Config. No 3"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=32kB --cacheline_size=16 -c $BENCHMARK1

STATSOUT=/home/tdwood2/project/project3/Program/mm/stats_4.txt
STDOUT=/home/tdwood2/project/project3/Program/mm/stdout_4.txt
STDERR=/home/tdwood2/project/project3/Program/mm/stderr_4.txt

echo "Executing Config. No 4"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=32kB --cacheline_size=64 -c $BENCHMARK1


STATSOUT=/home/tdwood2/project/project3/Program/mm/stats_5.txt
STDOUT=/home/tdwood2/project/project3/Program/mm/stdout_5.txt
STDERR=/home/tdwood2/project/project3/Program/mm/stderr_5.txt

echo "Executing Config. No 5"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=4 --l1i_assoc=2 --l2_assoc=16 --l2_size=32kB --cacheline_size=64 -c $BENCHMARK1

echo "****************************************************************"
echo "					Basic Math"
echo "****************************************************************"

STATSOUT=/home/tdwood2/project/project3/Program/bm/stats_1.txt
STDOUT=/home/tdwood2/project/project3/Program/bm/stdout_1.txt
STDERR=/home/tdwood2/project/project3/Program/bm/stderr_1.txt 

echo "Executing gem5..."
echo "Executing Config. No 1"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=8kB --l1i_size=8kB --l1d_assoc=1 --l1i_assoc=1 --l2_assoc=4 --l2_size=16kB --cacheline_size=16 -c $BENCHMARK2


STATSOUT=/home/tdwood2/project/project3/Program/bm/stats_2.txit
STDOUT=/home/tdwood2/project/project3/Program/bm/stdout_2.txt
STDERR=/home/tdwood2/project/project3/Program/bm/stderr_2.txt

echo "Executing Config. No 2"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=8kB --l1i_size=8kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=16kB --cacheline_size=16 -c $BENCHMARK2 


STATSOUT=/home/tdwood2/project/project3/Program/bm/stats_3.txt
STDOUT=/home/tdwood2/project/project3/Program/bm/stdout_3.txt
STDERR=/home/tdwood2/project/project3/Program/bm/stderr_3.txt

echo "Executing Config. No 3"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=32kB --cacheline_size=16 -c $BENCHMARK2

STATSOUT=/home/tdwood2/project/project3/Program/bm/stats_4.txt
STDOUT=/home/tdwood2/project/project3/Program/bm/stdout_4.txt
STDERR=/home/tdwood2/project/project3/Program/bm/stderr_4.txt

echo "Executing Config. No 4"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=32kB --cacheline_size=64 -c $BENCHMARK2


STATSOUT=/home/tdwood2/project/project3/Program/bm/stats_5.txt
STDOUT=/home/tdwood2/project/project3/Program/bm/stdout_5.txt
STDERR=/home/tdwood2/project/project3/Program/bm/stderr_5.txt

echo "Executing Config. No 5"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=4 --l1i_assoc=2 --l2_assoc=16 --l2_size=32kB --cacheline_size=64 -c $BENCHMARK2

echo "****************************************************************"
echo "					FFT"
echo "****************************************************************"

STATSOUT=/home/tdwood2/project/project3/Program/fft/stats_1.txt
STDOUT=/home/tdwood2/project/project3/Program/fft/stdout_1.txt
STDERR=/home/tdwood2/project/project3/Program/fft/stderr_1.txt

echo "Executing gem5..."
echo "Executing Config. No 1"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=8kB --l1i_size=8kB --l1d_assoc=1 --l1i_assoc=1 --l2_assoc=4 --l2_size=16kB --cacheline_size=16 -c $BENCHMARK3 -o $BENCHINPUT3


STATSOUT=/home/tdwood2/project/project3/Program/fft/stats_2.txit
STDOUT=/home/tdwood2/project/project3/Program/fft/stdout_2.txt
STDERR=/home/tdwood2/project/project3/Program/fft/stderr_2.txt

echo "Executing Config. No 2"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=8kB --l1i_size=8kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=16kB --cacheline_size=16 -c $BENCHMARK3 -o $BENCHINPUT3


STATSOUT=/home/tdwood2/project/project3/Program/fft/stats_3.txt
STDOUT=/home/tdwood2/project/project3/Program/fft/stdout_3.txt
STDERR=/home/tdwood2/project/project3/Program/fft/stderr_3.txt

echo "Executing Config. No 3"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=32kB --cacheline_size=16 -c $BENCHMARK3 -o $BENCHINPUT3

STATSOUT=/home/tdwood2/project/project3/Program/fft/stats_4.txt
STDOUT=/home/tdwood2/project/project3/Program/fft/stdout_4.txt
STDERR=/home/tdwood2/project/project3/Program/fft/stderr_4.txt

echo "Executing Config. No 4"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=32kB --cacheline_size=64 -c $BENCHMARK3 -o $BENCHINPUT3


STATSOUT=/home/tdwood2/project/project3/Program/fft/stats_5.txt
STDOUT=/home/tdwood2/project/project3/Program/fft/stdout_5.txt
STDERR=/home/tdwood2/project/project3/Program/fft/stderr_5.txt

echo "Executing Config. No 5"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=4 --l1i_assoc=2 --l2_assoc=16 --l2_size=32kB --cacheline_size=64 -c $BENCHMARK3 -o $BENCHINPUT3

echo "****************************************************************"
echo "					dijkstra"
echo "****************************************************************"

STATSOUT=/home/tdwood2/project/project3/Program/dijkstra/stats_1.txt
STDOUT=/home/tdwood2/project/project3/Program/dijkstra/stdout_1.txt
STDERR=/home/tdwood2/project/project3/Program/dijkstra/stderr_1.txt

echo "Executing gem5..."
echo "Executing Config. No 1"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=8kB --l1i_size=8kB --l1d_assoc=1 --l1i_assoc=1 --l2_assoc=4 --l2_size=16kB --cacheline_size=16 -c $BENCHMARK4 -o $BENCHINPUT4


STATSOUT=/home/tdwood2/project/project3/Program/dijkstra/stats_2.txit
STDOUT=/home/tdwood2/project/project3/Program/dijkstra/stdout_2.txt
STDERR=/home/tdwood2/project/project3/Program/dijkstra/stderr_2.txt

echo "Executing Config. No 2"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=8kB --l1i_size=8kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=16kB --cacheline_size=16 -c $BENCHMARK4 -o $BENCHINPUT4


STATSOUT=/home/tdwood2/project/project3/Program/dijkstra/stats_3.txt
STDOUT=/home/tdwood2/project/project3/Program/dijkstra/stdout_3.txt
STDERR=/home/tdwood2/project/project3/Program/dijkstra/stderr_3.txt

echo "Executing Config. No 3"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=32kB --cacheline_size=16 -c $BENCHMARK4 -o $BENCHINPUT4

STATSOUT=/home/tdwood2/project/project3/Program/dijkstra/stats_4.txt
STDOUT=/home/tdwood2/project/project3/Program/dijkstra/stdout_4.txt
STDERR=/home/tdwood2/project/project3/Program/dijkstra/stderr_4.txt

echo "Executing Config. No 4"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=32kB --cacheline_size=64 -c $BENCHMARK4 -o $BENCHINPUT4


STATSOUT=/home/tdwood2/project/project3/Program/dijkstra/stats_5.txt
STDOUT=/home/tdwood2/project/project3/Program/dijkstra/stdout_5.txt
STDERR=/home/tdwood2/project/project3/Program/dijkstra/stderr_5.txt

echo "Executing Config. No 5"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=4 --l1i_assoc=2 --l2_assoc=16 --l2_size=32kB --cacheline_size=64 -c $BENCHMARK4 -o $BENCHINPUT4

echo "****************************************************************"
echo "					qsort"
echo "****************************************************************"

STATSOUT=/home/tdwood2/project/project3/Program/qsort/stats_1.txt
STDOUT=/home/tdwood2/project/project3/Program/qsort/stdout_1.txt
STDERR=/home/tdwood2/project/project3/Program/qsort/stderr_1.txt

echo "Executing gem5..."
echo "Executing Config. No 1"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=8kB --l1i_size=8kB --l1d_assoc=1 --l1i_assoc=1 --l2_assoc=4 --l2_size=16kB --cacheline_size=16 -c $BENCHMARK5 -o $BENCHINPUT5


STATSOUT=/home/tdwood2/project/project3/Program/qsort/stats_2.txit
STDOUT=/home/tdwood2/project/project3/Program/qsort/stdout_2.txt
STDERR=/home/tdwood2/project/project3/Program/qsort/stderr_2.txt

echo "Executing Config. No 2"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=8kB --l1i_size=8kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=16kB --cacheline_size=16 -c $BENCHMARK5 -o $BENCHINPUT5


STATSOUT=/home/tdwood2/project/project3/Program/qsort/stats_3.txt
STDOUT=/home/tdwood2/project/project3/Program/qsort/stdout_3.txt
STDERR=/home/tdwood2/project/project3/Program/qsort/stderr_3.txt

echo "Executing Config. No 3"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=32kB --cacheline_size=16 -c $BENCHMARK5 -o $BENCHINPUT5

STATSOUT=/home/tdwood2/project/project3/Program/qsort/stats_4.txt
STDOUT=/home/tdwood2/project/project3/Program/qsort/stdout_4.txt
STDERR=/home/tdwood2/project/project3/Program/qsort/stderr_4.txt

echo "Executing Config. No 4"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=2 --l1i_assoc=2 --l2_assoc=8 --l2_size=32kB --cacheline_size=64 -c $BENCHMARK5 -o $BENCHINPUT5


STATSOUT=/home/tdwood2/project/project3/Program/qsort/stats_5.txt
STDOUT=/home/tdwood2/project/project3/Program/qsort/stdout_5.txt
STDERR=/home/tdwood2/project/project3/Program/qsort/stderr_5.txt

echo "Executing Config. No 5"
$GEM5 --stats-file=$STATSOUT --stdout-file=$STDOUT --stderr-file=$STDERR -re $SEPY --cpu-type=$CPUTYPE --caches --l2cache --num-l2caches=$NUML2CACHE --l1d_size=16kB --l1i_size=16kB --l1d_assoc=4 --l1i_assoc=2 --l2_assoc=16 --l2_size=32kB --cacheline_size=64 -c $BENCHMARK5 -o $BENCHINPUT5
